using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ItemTrigger : MonoBehaviour
{
    public ItemObject itemObject => GetComponentInParent<ItemObject>();

    [SerializeField] private bool canPick = true;

    public void SetCanPick(bool canPick)
    { 
        this.canPick = canPick;
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (canPick && collision.gameObject.tag == "Player")
        {
            itemObject.PickItem();
        }
    }
}
